/**
 * Copyright (c) 2017 hadlinks, All Rights Reserved.
 */
package com.bugull.farm.core.control.example;


import com.bugull.farm.core.control.AbstractBuguEvent;
import com.bugull.farm.core.enums.CommandEnum;

/**
 * Project Name: bugu-farm-household
 * Package Name: com.bugull.farm.core.example
 * ClassName: CmdResEvent 
 * Function: 命令响应事件，当服务器主动下发的命令收到设备相应的响应后，触发本事件.
 * date: 2017/10/27 18:24
 * @author songwei (songw@hadlinks.com)
 * @since JDK 1.8 
 */
public class CmdResEvent extends AbstractBuguEvent {

    private CommandEnum cmd;

    private String serial;

    private String terminalSN;

    /**
     * Constructs a prototypical Event.
     *
     * @param source The object on which the Event initially occurred.
     * @throws IllegalArgumentException if source is null.
     */
    public CmdResEvent(Object source) {
        super(source);
    }

    private CmdResEvent(Object source, Builder builder) {
        super(source);
        this.cmd = builder.cmd;
        this.serial = builder.serial;
        this.terminalSN = builder.terminalSN;
    }

    public static class Builder {

        private final CommandEnum cmd;

        private String serial;

        private final String terminalSN;

        public Builder(CommandEnum cmd, String terminalSN) {
            this.cmd = cmd;
            this.terminalSN = terminalSN;
        }

        public CommandEnum getCmd() {
            return cmd;
        }

        public String getSerial() {
            return serial;
        }

        public Builder setSerial(String serial) {
            this.serial = serial;
            return this;
        }

        public String getTerminalSN() {
            return terminalSN;
        }
    }

    public CommandEnum getCmd() {
        return cmd;
    }

    public void setCmd(CommandEnum cmd) {
        this.cmd = cmd;
    }

    public String getSerial() {
        return serial;
    }

    public void setSerial(String serial) {
        this.serial = serial;
    }

    public String getTerminalSN() {
        return terminalSN;
    }

    public void setTerminalSN(String terminalSN) {
        this.terminalSN = terminalSN;
    }
}
